/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('yuqing', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConsoleBody {
  appCode?: string(name='appCode'),
  interfaceName?: string(name='interfaceName'),
  paramJson?: string(name='paramJson'),
  requestId?: string(name='requestId'),
  teamHashId?: string(name='teamHashId'),
}

model FieldCondition {
  fieldName?: string(name='fieldName', example='xxx'),
  nestFieldPath?: string(name='nestFieldPath'),
  nestFieldValue?: [ long ](name='nestFieldValue'),
  operateType?: string(name='operateType', example='='),
  value?: string(name='value', example='yyy'),
}

model ProductInstance {
  appCode?: string(name='appCode', description='This parameter is required.', example='EUWYEEQ'),
  buyerName?: string(name='buyerName', example='xxx'),
  buyerUid?: string(name='buyerUid', description='This parameter is required.', example='ID2343231321'),
  channel?: string(name='channel', description='This parameter is required.', example='ALIYUN'),
  config?: string(name='config', example='{}'),
  end?: long(name='end', example='1640292843231'),
  instanceId?: string(name='instanceId', description='This parameter is required.', example='ID3928389103844'),
  orderNo?: string(name='orderNo', description='This parameter is required.', example='D23938474923u42'),
  productCode?: string(name='productCode', description='This parameter is required.', example='C394884'),
  productSpecCode?: string(name='productSpecCode', description='This parameter is required.', example='C847573'),
  start?: long(name='start', example='1640292843231'),
  tenantName?: string(name='tenantName', example='XXX'),
  tenantUid?: string(name='tenantUid', description='This parameter is required.', example='UID284747383'),
}

model SearchCondition {
  assKeywordList?: [ string ](name='assKeywordList', example='["A&&B","C"]'),
  atAuthorNameList?: [ string ](name='atAuthorNameList', example='xxx'),
  authorNameList?: [ string ](name='authorNameList', example='xxx'),
  commentsLevel?: int32(name='commentsLevel', example='1'),
  contentLenLevel?: int32(name='contentLenLevel', example='1'),
  createTimeEnd?: long(name='createTimeEnd', example='1620452881429'),
  createTimeStart?: long(name='createTimeStart', example='1610452881429'),
  docContentSign?: string(name='docContentSign', example='3478278371214'),
  docIdList?: [ string ](name='docIdList', example='5747368272834931'),
  duplicateRemoval?: boolean(name='duplicateRemoval', example='true'),
  emotionType?: int32(name='emotionType', example='1'),
  enableKeywordHighlight?: boolean(name='enableKeywordHighlight', example='true'),
  excludeAtAuthorNameList?: [ string ](name='excludeAtAuthorNameList', example='xxx'),
  excludeAuthorNameList?: [ string ](name='excludeAuthorNameList', example='新浪财经'),
  excludeHostNameList?: [ string ](name='excludeHostNameList', example='finance.sina.com.cn'),
  excludeKeywordList?: [ string ](name='excludeKeywordList', example='["A&&B","C"]'),
  excludeKeywordListInTitle?: [ string ](name='excludeKeywordListInTitle', example='["A&&B","C"]'),
  excludeKeywordTagIds?: [ long ](name='excludeKeywordTagIds', example='123,456'),
  excludeMaterialTagList?: [ string ](name='excludeMaterialTagList'),
  excludeMediaLibraryIdList?: [ string ](name='excludeMediaLibraryIdList', example='123,456'),
  excludeMediaNameList?: [ string ](name='excludeMediaNameList', example='新浪财经'),
  excludeMediaTypeList?: [ string ](name='excludeMediaTypeList', example='WEIBO-REPOST_WEIBO'),
  excludeMessageTypeList?: [ string ](name='excludeMessageTypeList', example='COMMENT'),
  fieldConditions?: [
    FieldCondition
  ](name='fieldConditions'),
  filterId?: long(name='filterId', example='12345'),
  hasAudio?: boolean(name='hasAudio', example='true'),
  hasImage?: boolean(name='hasImage', example='true'),
  hasMultiModeContent?: boolean(name='hasMultiModeContent'),
  hasVideo?: boolean(name='hasVideo', example='true'),
  hostNameList?: [ string ](name='hostNameList', example='finance.sina.com.cn'),
  influenceLevel?: long(name='influenceLevel', example='1'),
  keywordTagIds?: [ long ](name='keywordTagIds', example='123,456'),
  likesLevel?: int32(name='likesLevel', example='1'),
  materialTagList?: [ string ](name='materialTagList'),
  mediaLibraryIdList?: [ string ](name='mediaLibraryIdList', example='123,456'),
  mediaNameList?: [ string ](name='mediaNameList', example='新浪财经'),
  mediaTypeList?: [ string ](name='mediaTypeList', example='WEIBO-REPOST_WEIBO'),
  messageTypeList?: [ string ](name='messageTypeList', example='COMMENT'),
  pageNow?: int32(name='pageNow', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  parentDocId?: string(name='parentDocId', example='485738373837374'),
  posKeywordList?: [ string ](name='posKeywordList', example='["A&&B","C"]'),
  posKeywordListInTitle?: [ string ](name='posKeywordListInTitle', example='["A&&B","C"]'),
  projectId?: long(name='projectId', example='1234'),
  propagationLevel?: long(name='propagationLevel', example='1'),
  publishTimeEnd?: long(name='publishTimeEnd', example='1620452881429'),
  publishTimeStart?: long(name='publishTimeStart', example='1610452881429'),
  readsLevel?: int32(name='readsLevel', example='1'),
  relevanceLevel?: int32(name='relevanceLevel', example='1'),
  repostLevel?: int32(name='repostLevel', example='1'),
  sortBy?: string(name='sortBy', example='PUBLISH_TIME'),
  sortByDirection?: string(name='sortByDirection', example='+'),
  topicList?: [ string ](name='topicList', example='#xxxx#'),
  updateTimeEnd?: long(name='updateTimeEnd', example='1620452881429'),
  updateTimeStart?: long(name='updateTimeStart', example='1610452881429'),
}

model YuqingFinanceEvent {
  comprehensiveRisk?: double(name='comprehensiveRisk'),
  entityArea?: string(name='entityArea'),
  entityCrn?: string(name='entityCrn'),
  entityEmotionScore?: double(name='entityEmotionScore'),
  entityId?: long(name='entityId'),
  entityName?: string(name='entityName'),
  entityRelevanceScore?: double(name='entityRelevanceScore'),
  entityShowName?: string(name='entityShowName'),
  entitySummary?: string(name='entitySummary'),
  entityType?: string(name='entityType'),
  eventId?: string(name='eventId'),
  eventLevel3Code?: long(name='eventLevel3Code'),
  eventLevel3Name?: string(name='eventLevel3Name'),
  eventTags?: string(name='eventTags'),
  eventTime?: long(name='eventTime'),
  securityAbbreviation?: string(name='securityAbbreviation'),
  securityCategoryCodes?: [ string ](name='securityCategoryCodes'),
  securityCodes?: [ string ](name='securityCodes'),
  securityMarketsCodes?: [ string ](name='securityMarketsCodes'),
  spamScore?: double(name='spamScore'),
  userSubscribeEntityTags?: [ string ](name='userSubscribeEntityTags'),
  userSubscribeEventTags?: [ long ](name='userSubscribeEventTags'),
}

model YuqingMessage {
  appName?: string(name='appName', example='Alipay'),
  appScore?: long(name='appScore', example='3'),
  appStoreName?: string(name='appStoreName', example='HUAWEI_APPSTORE'),
  atAuthorNames?: [ string ](name='atAuthorNames'),
  audioCount?: int32(name='audioCount', example='1'),
  authorAvatarUrl?: string(name='authorAvatarUrl', example='https://xxx.png'),
  authorFollowersCount?: long(name='authorFollowersCount', example='12'),
  authorFriendsCount?: long(name='authorFriendsCount', example='12'),
  authorGender?: string(name='authorGender', example='f'),
  authorId?: string(name='authorId', example='xxx'),
  authorLikesCount?: long(name='authorLikesCount', example='100'),
  authorName?: string(name='authorName', example='xxx'),
  authorProfileUrl?: string(name='authorProfileUrl', example='http://xxx'),
  authorStatusesCount?: long(name='authorStatusesCount', example='12'),
  authorVerified?: boolean(name='authorVerified', example='true'),
  authorVerifyType?: int32(name='authorVerifyType', example='1'),
  contentAudioText?: string(name='contentAudioText', example='["xxx","yyy"]'),
  contentAudioUrls?: string(name='contentAudioUrls', example='["http://xx.mp3","http://yy.mp3"]'),
  contentImageText?: string(name='contentImageText', example='["xxx","yyy"]'),
  contentImageUrls?: string(name='contentImageUrls', example='["http://xx.png","http://xx.jpeg"]'),
  contentLang?: string(name='contentLang', example='zh'),
  contentLen?: long(name='contentLen', example='100'),
  contentVideoText?: string(name='contentVideoText', example='["xxx","yyy"]'),
  contentVideoUrls?: string(name='contentVideoUrls', example='["http://xx.mpeg","http://yy.mp4"]'),
  createTime?: long(name='createTime', example='165202930291'),
  docAnswersCount?: long(name='docAnswersCount', example='100'),
  docAreas?: [ string ](name='docAreas'),
  docCoinCount?: long(name='docCoinCount', example='100'),
  docCommentsCount?: long(name='docCommentsCount', example='100'),
  docContent?: string(name='docContent', example='xxxx'),
  docContentBrief?: string(name='docContentBrief', example='xxxx'),
  docContentSign?: string(name='docContentSign', example='81728391712912'),
  docId?: string(name='docId', example='48573837837232'),
  docLikesCount?: long(name='docLikesCount', example='100'),
  docPlayCount?: long(name='docPlayCount', example='100'),
  docReadingCount?: long(name='docReadingCount', example='100'),
  docReadsCount?: long(name='docReadsCount', example='100'),
  docRepostsCount?: long(name='docRepostsCount', example='100'),
  docReprintName?: string(name='docReprintName', example='成都日报'),
  docSelfContentSign?: string(name='docSelfContentSign', example='81728391712912'),
  docTitle?: string(name='docTitle', example='xxx'),
  docUrl?: string(name='docUrl', example='http://xxx'),
  emotionScore?: double(name='emotionScore', example='4.3'),
  emotionType?: int32(name='emotionType', example='1'),
  extInfo?: map[string]string(name='extInfo'),
  finEventCount?: int32(name='finEventCount', example='1'),
  financeEventList?: [
    YuqingFinanceEvent
  ](name='financeEventList'),
  highlightKeywords?: [ string ](name='highlightKeywords'),
  imageCount?: int32(name='imageCount', example='1'),
  influenceScore?: double(name='influenceScore', example='4.1'),
  mediaHosts?: [ string ](name='mediaHosts'),
  mediaInfluenceLevel?: int32(name='mediaInfluenceLevel', example='1'),
  mediaName?: string(name='mediaName', example='新浪财经'),
  mediaPropagationLevel?: int32(name='mediaPropagationLevel', example='1'),
  mediaType?: string(name='mediaType', example='WEIBO-REPOST_WEIBO'),
  messageType?: string(name='messageType', example='COMMENT'),
  parentDocId?: string(name='parentDocId', example='484747382721'),
  propagationScore?: double(name='propagationScore', example='3.9'),
  publishTime?: long(name='publishTime', example='165202930291'),
  relevanceScore?: double(name='relevanceScore', example='5.2'),
  reportMaterialTags?: [ string ](name='reportMaterialTags'),
  repostList?: [ string ](name='repostList'),
  similarNumber?: int32(name='similarNumber', example='12'),
  topics?: [ string ](name='topics'),
  videoCount?: int32(name='videoCount', example='1'),
  weiboCommentId?: string(name='weiboCommentId', example='4837383832323'),
  weiboMid?: string(name='weiboMid', example='465758363823'),
}

model CloseProductRequest {
  productInstance?: ProductInstance(name='productInstance'),
  requestId?: string(name='requestId'),
}

model CloseProductResponseBody = {
  data?: long(name='data'),
  requestId?: string(name='requestId'),
}

model CloseProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CloseProductResponseBody(name='body'),
}

/**
 * @summary 关闭舆情产品
 *
 * @param request CloseProductRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CloseProductResponse
 */
async function closeProductWithOptions(request: CloseProductRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CloseProductResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.productInstance)) {
    body['productInstance'] = request.productInstance;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CloseProduct',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/closeProduct.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 关闭舆情产品
 *
 * @param request CloseProductRequest
 * @return CloseProductResponse
 */
async function closeProduct(request: CloseProductRequest): CloseProductResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return closeProductWithOptions(request, headers, runtime);
}

model ConsoleApiProxyRequest {
  body?: ConsoleBody(name='body'),
}

model ConsoleApiProxyResponseBody = {
  requestId?: string(name='requestId'),
  resultJson?: string(name='resultJson'),
}

model ConsoleApiProxyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConsoleApiProxyResponseBody(name='body'),
}

/**
 * @summary 控制台统一代理API
 *
 * @param request ConsoleApiProxyRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConsoleApiProxyResponse
 */
async function consoleApiProxyWithOptions(request: ConsoleApiProxyRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ConsoleApiProxyResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'ConsoleApiProxy',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/consoleApiProxy.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 控制台统一代理API
 *
 * @param request ConsoleApiProxyRequest
 * @return ConsoleApiProxyResponse
 */
async function consoleApiProxy(request: ConsoleApiProxyRequest): ConsoleApiProxyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return consoleApiProxyWithOptions(request, headers, runtime);
}

model ConsoleProxyRequest {
  appCode?: string(name='appCode'),
  interfaceName?: string(name='interfaceName'),
  paramJson?: string(name='paramJson'),
  requestId?: string(name='requestId'),
  teamHashId?: string(name='teamHashId'),
}

model ConsoleProxyResponseBody = {
  requestId?: string(name='requestId'),
  resultJson?: string(name='resultJson'),
}

model ConsoleProxyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConsoleProxyResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI ConsoleProxy is deprecated
 *
 * @summary 控制台统一代理API
 *
 * @param request ConsoleProxyRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConsoleProxyResponse
 */
// Deprecated
async function consoleProxyWithOptions(request: ConsoleProxyRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ConsoleProxyResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.appCode)) {
    body['appCode'] = request.appCode;
  }
  if (!Util.isUnset(request.interfaceName)) {
    body['interfaceName'] = request.interfaceName;
  }
  if (!Util.isUnset(request.paramJson)) {
    body['paramJson'] = request.paramJson;
  }
  if (!Util.isUnset(request.teamHashId)) {
    body['teamHashId'] = request.teamHashId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ConsoleProxy',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/consoleProxy.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @deprecated OpenAPI ConsoleProxy is deprecated
 *
 * @summary 控制台统一代理API
 *
 * @param request ConsoleProxyRequest
 * @return ConsoleProxyResponse
 */
// Deprecated
async function consoleProxy(request: ConsoleProxyRequest): ConsoleProxyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return consoleProxyWithOptions(request, headers, runtime);
}

model GetAnalysisTaskResultRequest {
  analysisId?: long(name='analysisId'),
  requestId?: string(name='requestId'),
  teamHashId?: string(name='teamHashId'),
}

model GetAnalysisTaskResultResponseBody = {
  analysisId?: long(name='analysisId'),
  requestId?: string(name='requestId'),
  resultJson?: string(name='resultJson'),
}

model GetAnalysisTaskResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAnalysisTaskResultResponseBody(name='body'),
}

/**
 * @summary 读取分析组件计算任务结果
 *
 * @param request GetAnalysisTaskResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAnalysisTaskResultResponse
 */
async function getAnalysisTaskResultWithOptions(request: GetAnalysisTaskResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetAnalysisTaskResultResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.analysisId)) {
    query['analysisId'] = request.analysisId;
  }
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.teamHashId)) {
    query['teamHashId'] = request.teamHashId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAnalysisTaskResult',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/getAnalysisComponentResult.json`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 读取分析组件计算任务结果
 *
 * @param request GetAnalysisTaskResultRequest
 * @return GetAnalysisTaskResultResponse
 */
async function getAnalysisTaskResult(request: GetAnalysisTaskResultRequest): GetAnalysisTaskResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAnalysisTaskResultWithOptions(request, headers, runtime);
}

model OpenProductRequest {
  clientToken?: string(name='ClientToken'),
  productInstance?: ProductInstance(name='productInstance'),
  requestId?: string(name='requestId'),
}

model OpenProductResponseBody = {
  id?: long(name='id'),
  requestId?: string(name='requestId'),
}

model OpenProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OpenProductResponseBody(name='body'),
}

/**
 * @summary 开通舆情产品
 *
 * @param request OpenProductRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return OpenProductResponse
 */
async function openProductWithOptions(request: OpenProductRequest, headers: map[string]string, runtime: Util.RuntimeOptions): OpenProductResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.productInstance)) {
    body['productInstance'] = request.productInstance;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'OpenProduct',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/openProduct.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开通舆情产品
 *
 * @param request OpenProductRequest
 * @return OpenProductResponse
 */
async function openProduct(request: OpenProductRequest): OpenProductResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return openProductWithOptions(request, headers, runtime);
}

model QueryProductInstanceListRequest {
  appCode?: string(name='appCode'),
  fromTime?: long(name='fromTime'),
  requestId?: string(name='requestId'),
  tenantUid?: string(name='tenantUid'),
  toTime?: long(name='toTime'),
}

model QueryProductInstanceListResponseBody = {
  instanceList?: [
    ProductInstance
  ](name='instanceList'),
  requestId?: string(name='requestId'),
}

model QueryProductInstanceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryProductInstanceListResponseBody(name='body'),
}

/**
 * @summary 查询产品开通实例列表
 *
 * @param request QueryProductInstanceListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryProductInstanceListResponse
 */
async function queryProductInstanceListWithOptions(request: QueryProductInstanceListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryProductInstanceListResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.appCode)) {
    query['appCode'] = request.appCode;
  }
  if (!Util.isUnset(request.fromTime)) {
    query['fromTime'] = request.fromTime;
  }
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }
  if (!Util.isUnset(request.tenantUid)) {
    query['tenantUid'] = request.tenantUid;
  }
  if (!Util.isUnset(request.toTime)) {
    query['toTime'] = request.toTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryProductInstanceList',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/queryProductInstanceList.json`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询产品开通实例列表
 *
 * @param request QueryProductInstanceListRequest
 * @return QueryProductInstanceListResponse
 */
async function queryProductInstanceList(request: QueryProductInstanceListRequest): QueryProductInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryProductInstanceListWithOptions(request, headers, runtime);
}

model QueryYuqingMessageRequest {
  requestId?: string(name='requestId', example='5645a6c9-7d21-4926-a410-db9a1af85faa'),
  searchCondition?: SearchCondition(name='searchCondition'),
  teamHashId?: string(name='teamHashId', example='xxxx43434dsdsd'),
}

model QueryYuqingMessageResponseBody = {
  requestId?: string(name='requestId', description='Id of the request', example='adacae47-6fc0-45c6-897c-26201aefbdfd'),
  totalCount?: long(name='totalCount', example='20'),
  yuqingMessages?: [
    YuqingMessage
  ](name='yuqingMessages'),
}

model QueryYuqingMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryYuqingMessageResponseBody(name='body'),
}

/**
 * @summary 查询舆情文章列表
 *
 * @param request QueryYuqingMessageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryYuqingMessageResponse
 */
async function queryYuqingMessageWithOptions(request: QueryYuqingMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryYuqingMessageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.searchCondition)) {
    body['searchCondition'] = request.searchCondition;
  }
  if (!Util.isUnset(request.teamHashId)) {
    body['teamHashId'] = request.teamHashId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryYuqingMessage',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/queryYuqingMessage.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询舆情文章列表
 *
 * @param request QueryYuqingMessageRequest
 * @return QueryYuqingMessageResponse
 */
async function queryYuqingMessage(request: QueryYuqingMessageRequest): QueryYuqingMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryYuqingMessageWithOptions(request, headers, runtime);
}

model SubmitAnalysisTaskRequest {
  analyseType?: string(name='analyseType'),
  requestId?: string(name='requestId'),
  searchCondition?: SearchCondition(name='searchCondition'),
  teamHashId?: string(name='teamHashId'),
}

model SubmitAnalysisTaskResponseBody = {
  analysisId?: long(name='analysisId'),
  requestId?: string(name='requestId'),
  resultJson?: string(name='resultJson'),
}

model SubmitAnalysisTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitAnalysisTaskResponseBody(name='body'),
}

/**
 * @summary 提交分析组件计算任务
 *
 * @param request SubmitAnalysisTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitAnalysisTaskResponse
 */
async function submitAnalysisTaskWithOptions(request: SubmitAnalysisTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitAnalysisTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.requestId)) {
    query['requestId'] = request.requestId;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.analyseType)) {
    body['analyseType'] = request.analyseType;
  }
  if (!Util.isUnset(request.searchCondition)) {
    body['searchCondition'] = request.searchCondition;
  }
  if (!Util.isUnset(request.teamHashId)) {
    body['teamHashId'] = request.teamHashId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SubmitAnalysisTask',
    version = '2022-03-01',
    protocol = 'HTTPS',
    pathname = `/openapi/aliyun/submitAnalysisComponent.json`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 提交分析组件计算任务
 *
 * @param request SubmitAnalysisTaskRequest
 * @return SubmitAnalysisTaskResponse
 */
async function submitAnalysisTask(request: SubmitAnalysisTaskRequest): SubmitAnalysisTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return submitAnalysisTaskWithOptions(request, headers, runtime);
}

